package com.raising.sc;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.raising.sc.util.HttpRequest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

/**
 * 启动类
 * @author GaoYuan
 * @datetime 2018/3/27 上午10:24
 * @EnableDiscoveryClient  使应用程序成为Consul“服务”（即注册自己）和“客户端”（即可以查询Consul查找其他服务）
 */
@SpringBootApplication
@EnableDiscoveryClient
@RestController
public class ServiceBStarter
{


    @ApiOperation("这是一个操作")
    @RequestMapping(value = "/hi",method = {RequestMethod.GET,RequestMethod.POST})
    public String a(@ApiParam("这个是参数") String str) {
        //发送 GET 请求
        String s = HttpRequest.sendGet("http://localhost:30001/hi", "str=" + str);
        return s;
    }


    public static void main(String[] args) {
        new SpringApplicationBuilder(ServiceBStarter.class).web(true).run(args);
    }

}
